home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 January: Mac OS SDK / Dev.CD Jan 98 SDK1.toast / Development Kits (Disc 1) / AIAT 1.0.1 / Headers / Index / VectorIndex.h < prev   
Encoding:
Text File  |  1997-09-11  |  2.3 KB  |  84 lines  |  [TEXT/CWIE]

  1. // VectorIndex.h
  2. //    Copyright:    © 1994 - 1996 by Apple Computer, Inc., all rights reserved.
  3.  
  4. //// IAIndex that stores vectors.
  5.  
  6. #pragma once
  7. #ifndef VectorIndex_h
  8. #define VectorIndex_h
  9.  
  10. #pragma import on
  11.  
  12. #include "TermIndex.h"
  13. #include "TFVector.h"
  14.  
  15. #pragma IA_BEGIN_EXPORTS
  16.  
  17. const uint32        VectorIndexType = 'Vec4';
  18.  
  19. class VectorDocInfo : public DocInfo {
  20. public:
  21.         VectorDocInfo() : vectorBlock(0), DocInfo() {}
  22.         VectorDocInfo(IADoc* d, DocID i) :  DocInfo(d,i), vectorBlock(0) {}
  23.     // IAOrderedStorable methods
  24.     IAStorable*            DeepCopy() const;
  25.     IABlockSize            StoreSize() const;
  26.     void                Store(IAOutputBlock* output) const;
  27.     IAStorable*            Restore(IAInputBlock* input) const;
  28.     IABlockID            GetVectorBlockID() const {return vectorBlock;}
  29.     void                SetVectorBlockID(IABlockID blockID){vectorBlock = blockID;}
  30. protected:
  31.     void                DeepCopying(const IAStorable* source);
  32.     void                Restoring(IAInputBlock* input, const IAStorable* proto);
  33. private:
  34.                         VectorDocInfo(VectorDocInfo&);
  35.     IABlockID            vectorBlock;
  36.  
  37. };
  38.  
  39. // needed for private member declaration
  40. class TermIdUpdateSet;
  41.  
  42. class VectorIndex : public virtual TermIndex {
  43. public:
  44.         VectorIndex(IAStorage* s, IACorpus* c, IAAnalysis* a,
  45.                     uint32 t = VectorIndexType, IABlockID r = NULL);
  46.         ~VectorIndex();
  47.                     
  48.     // VectorIndex-specific method:
  49.     virtual TFVector*    GetTFVector(IADoc* doc);
  50.  
  51.     IADefineNarrowMethods(VectorIndex, IAIndex);        // support for IANarrow
  52.     
  53.     virtual bool ValidateDocInfos(bool verbose);
  54.     
  55. protected:
  56.     // TermIndex methods we augment to store vectors:
  57.     DocInfo*            MakeDocInfo(IADoc* doc, DocID docID);
  58.     void                UpdateDocInfo(DocInfo* i, TFVector* vector);
  59.     void                MergeDocInfo(DocInfo* i, DocInfo* addDi, TermIndex* addIndex, TermID* reMap);
  60.     uint32                MergeDocCost();
  61.  
  62.     void                FlushUpdates();
  63.     void                DeletingDoc(DocInfo* i);
  64.     // Optimized version of GetTFMaps.
  65.     bool                GetTFMaps(IADoc** docs, uint32 nDocs, TFMap** tfMaps, Progress* p);
  66.     // delete doc clean up
  67.     void                 ExpungeTermPostings(); 
  68. private:
  69.     void                WriteTFVector(TFVector* vector, IABlockID block);
  70.     
  71.     TFVector*            ReadTFVector(IABlockID block);
  72.     TFVector*            ReadTFVector(IAStorage* storage, IABlockID block);
  73.     
  74.     TermIdUpdateSet*    termIdUpdateSet;
  75.     void                FlushTermIdUpdates();
  76.  
  77.                         VectorIndex(VectorIndex&);
  78. };
  79.  
  80. #pragma IA_END_EXPORTS
  81.  
  82. #pragma import reset
  83. #endif
  84.